﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraBars;
using System.Data.SqlClient;
using DevExpress.XtraEditors.Repository;
using DevExpress.XtraBars.Ribbon;
using DevExpress.XtraBars.Helpers;
using DevExpress.XtraBars.Localization;

namespace Final
{
    public partial class SaleForm : DevExpress.XtraBars.Ribbon.RibbonForm
    {
        public SaleForm()
        {
            InitializeComponent();

        }

        private void SaleForm_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'lIMSDataSet.KHACHHANG' table. You can move, or remove it, as needed.
            //this.kHACHHANGTableAdapter.Fill(this.lIMSDataSet.KHACHHANG);
            CenterToScreen();
            repositoryItemComboBox3.Items.Add("Mã số thuế");
            repositoryItemComboBox3.Items.Add("Tên Khách Hàng");
            repositoryItemComboBox3.Items.Add("Tên Công ty");

            //Making ribbon Skin
            BarLocalizer.Active = new MyBarLocalizer();
            SkinHelper.InitSkinGallery(ribbonGalleryBarItem1, true);
            //SkinHelper.InitSkinPopupMenu(popupMenu1);
            //SkinHelper.InitSkinPopupMenu(ribbonGalleryBarItem1);
            
        }
        //private void DanhsachKH_Load()
        //{
        //    try
        //    {
        //        SqlConnection con = new SqlConnection(@"Data Source=NGUYENJOBS\SQLEXPRESS;Initial Catalog=LIMS;User ID=sa;Password=123456");
        //        con.Open();
        //        SqlCommand cmd = new SqlCommand();
        //        cmd.Connection = con;
        //        string show = "SELECT * FROM KHACHHANG";
        //        cmd.CommandText = show;
        //        SqlDataAdapter da = new SqlDataAdapter(show, con);
        //        DataSet ds = new DataSet();
        //        // Fill date to ds
        //        da.Fill(ds, "KHACHHANG");
        //        // Fill Dato from DataSet to DataGridView
        //        gridControl1.DataSource = ds.Tables["KHACHHANG"];
        //        // Closed Connect
        //        con.Dispose();
        //        da.Dispose();
        //        cmd.Dispose();
        //    }
        //    catch (SqlException)
        //    {

        //    }
        //}

        private void barButtonItem1_ItemClick(object sender, ItemClickEventArgs e)
        {
            panelControl2.Controls.Clear();
            ucQuotation1 frm = new ucQuotation1();
            frm.Dock = System.Windows.Forms.DockStyle.Fill;
            panelControl2.Controls.Add(frm);
        }

        private void barButtonItem5_ItemClick(object sender, ItemClickEventArgs e)
        {
            DialogResult result;
            result = MessageBox.Show("Bạn có chắc chắn thoát không?", "Warning!", MessageBoxButtons.YesNo,
                MessageBoxIcon.Warning);
            if (result == DialogResult.Yes)
            {
                Application.Exit();
            }
        }

        private void barButtonItem31_ItemClick(object sender, ItemClickEventArgs e)
        {
            frmThemUser frmAddUser = new frmThemUser();
            frmAddUser.ShowDialog();
        }

        private void simpleButton3_Click(object sender, EventArgs e)
        {
            MessageBox.Show("Bạn có chắc chắn xóa không", "Warning!", MessageBoxButtons.YesNo,
                MessageBoxIcon.Warning);
        }

        private void barButtonItem30_ItemClick(object sender, ItemClickEventArgs e)
        {
            frmEditUser frmUserInfor = new frmEditUser();
            frmUserInfor.ShowDialog();
        }

        private void barButtonItem4_ItemClick(object sender, ItemClickEventArgs e)
        {
            this.Hide();
            frmLogin frmLogin = new frmLogin();
            frmLogin.ShowDialog();
        }

        private void barButtonItem17_ItemClick(object sender, ItemClickEventArgs e)
        {
            panelControl2.Controls.Clear();
        }

        private void barButtonItem21_ItemClick(object sender, ItemClickEventArgs e)
        {
            panelControl2.Controls.Clear();
            ucDanhSachKH frmDanhSachKH = new ucDanhSachKH();
            frmDanhSachKH.Dock = System.Windows.Forms.DockStyle.Fill;
            panelControl2.Controls.Add(frmDanhSachKH);
        }

        private void barButtonItem35_ItemClick(object sender, ItemClickEventArgs e)
        {
            AboutBox1 frmAboutus = new AboutBox1();
            frmAboutus.ShowDialog();
        }

        private void btnThemKH_ItemClick(object sender, ItemClickEventArgs e)
        {
            panelControl2.Controls.Clear();
            ucThemKH frmThemKH = new ucThemKH();
            frmThemKH.Dock = System.Windows.Forms.DockStyle.Fill;
            panelControl2.Controls.Add(frmThemKH);
        }

    }
    //Skin
    public class MyBarLocalizer : BarLocalizer
    {
        public override string GetLocalizedString(BarString id)
        {
            if (id == BarString.SkinCaptions)
            {
                //Default value for BarString.SkinCaptions:
                //"|DevExpress Style|Caramel|Money Twins|DevExpress Dark Style|iMaginary|Lilian|Black|Blue|Office 2010 Blue|Office 2010 Black|Office 2010 Silver|Office 2007 Blue|Office 2007 Black|Office 2007 Silver|Office 2007 Green|Office 2007 Pink|Seven|Seven Classic|Darkroom|McSkin|Sharp|Sharp Plus|Foggy|Dark Side|Xmas (Blue)|Springtime|Summer|Pumpkin|Valentine|Stardust|Coffee|Glass Oceans|High Contrast|Liquid Sky|London Liquid Sky|The Asphalt World|Blueprint|"
                string defaultSkinCaptions = base.GetLocalizedString(id);
                string newSkinCaptions = defaultSkinCaptions.Replace("|DevExpress Style|", "|My Favorite Skin|");
                return newSkinCaptions;
            }
            return base.GetLocalizedString(id);
        }


    }
}